﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;

namespace KHOALUAN
{
    public partial class frmGiaoVien : Form
    {
        public frmGiaoVien()
        {
            InitializeComponent();
            clsMain.cls.KhoiTaoXMLTable(clsMain.FormGiaoVien, 3);
            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].ColumnName[0] = "MÃ SỐ";
            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].ColumnName[1] = "TÊN GIÁO VIÊN";
            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].ColumnName[2] = "CHỨC DANH";

            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].Names[0] = "MSGV";
            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].Names[1] = "TENGV";
            clsMain.cls.clsForm.xmlD[clsMain.FormGiaoVien].Names[2] = "CHUCDANH";

            
        }

        private void frmGiaoVien_Load(object sender, EventArgs e)
        {
            clsMain.cls.KhoiTaoFormControls(clsMain.FormGiaoVien);
            clsMain.cls.KhoiTaoFormControls(clsMain.FormGiaoVien, dgv);
            clsMain.cls.KhoiTaoFormControls(clsMain.FormGiaoVien, but);
        }

        private void dgv_MouseDoubleClick(object sender, EventArgs e)
        {
            clsMain.cls.AddDataToControls(clsMain.FormGiaoVien);
            butDangKy.Enabled = true;
        }

        private void but_Click(object sender, EventArgs e)
        {
            clsMain.cls.ButtonsClick(clsMain.FormGiaoVien, but.ClickState);
        }

       

        private void butDangKy_Click(object sender, EventArgs e)
        {
            try
            {
                butDangKy.Enabled = false;
                clsMain.strGiangVienCode = dgv.dgv.SelectedCells[0].Value.ToString();
                clsMain.strGiangVien = dgv.dgv.SelectedCells[1].Value.ToString();
                frmDangKyMonGiangDay frm = new frmDangKyMonGiangDay();
                frm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show("... \n\nChi tiết:\n" + ex, "Thông báo lỗi");
            }
            
        }

        private void txtChucDanh_DoubleClick(object sender, EventArgs e)
        {
            
            clsMain.cls.CallFormGridView(clsMain.FormGridView, clsMain.FormGiaoVien,clsMain.FormChucDanh,txtChucDanh.Tag.ToString());
        }
       

        

    }
}
